
package com.mj.adapters;

import org.json.JSONObject;

import android.content.Context;
import android.widget.RelativeLayout;

import com.baidu.mobads.AdService;
import com.baidu.mobads.AdView;
import com.baidu.mobads.AdViewListener;

public class AdBaiduAdapter extends CustomizedAdapter implements AdViewListener {
    
	private AdView adView;
//    private AdService adService;
	
	public AdBaiduAdapter(Object mjLayout, Object ration) {
		super(mjLayout, ration);
	}

    @Override
    public void onHandler(Context context, RelativeLayout parentLayout, String key1, String key2) {
        AdView.setAppSid(context, key1);
        AdView.setAppSec(context, key1);
        
        RelativeLayout relativeLayout = new RelativeLayout(context);
        RelativeLayout.LayoutParams adViewLayoutParams = new RelativeLayout.LayoutParams(-1, -2);
        adViewLayoutParams.addRule(13, -1);
        
        new AdService(context, relativeLayout, adViewLayoutParams, this);
        
        attachAdview2Layout(relativeLayout);
    }
	
	@Override
	public void onAdClick(JSONObject arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onAdFailed(String arg0) {

	    logDisplayAdFailed();
	}

	@Override
	public void onAdReady(AdView arg0) {

	    this.adView = arg0;

	}

	@Override
	public void onAdShow(JSONObject arg0) {

	    logDisplayAdSucceess();
	}

	@Override
	public void onAdSwitch() {        
        
	}

	@Override
	public void onVideoFinish() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onVideoStart() {
		// TODO Auto-generated method stub
		
	}

}